home *** CD-ROM | disk | FTP | other *** search
- # MakeAlias
-
- Perl -Sx -- "{0}" {"Parameters"}
- Exit
-
- #!perl
-
- # No special treatment if $newalias is blank.
- # That's most likely to be a scripting error.
- # Use ":" to create an alias in the local directory.
-
- my ($original, $newalias) = @ARGV;
- if (!symlink($original, $newalias)) {
- my $name;
- # Guessing that symlink failed because $newalias is a folder
- # Get the base name
- ($name = $original) =~ s/^(?:.*:)?(.+?):?$/$1/;
- # Prepend a colon, if necessary
- $newalias =~ s/^([^:]+)$/:$1/;
- # Append a colon, if necessary
- $newalias =~ s/([^:])$/$1:/;
- # Append the original's base name
- $newalias .= $name;
- symlink($original, $newalias) or
- die "Couldn't link '$original' to '$newalias'";
- }
-